home *** CD-ROM | disk | FTP | other *** search
- //-------------------------------------------------------------------//
-
- // Synopsis: Principal submatrix.
-
- // Syntax: sub ( A , i , j )
- // sub ( A, i )
-
- // Description:
-
- // sub(A,i,j) is A(i:j,i:j).
-
- // sub(A,i) is the leading principal submatrix of order i,
- // A[1:i;1:i], if i>0, and the trailing principal submatrix of
- // order ABS(i) if i<0.
-
- // This file is a translation of sub.m from version 2.0 of
- // "The Test Matrix Toolbox for Matlab", described in Numerical
- // Analysis Report No. 237, December 1993, by N. J. Higham.
-
- //-------------------------------------------------------------------//
-
- sub = function ( A , i , j )
- {
- if (!exist (j))
- {
- if (i >= 0)
- {
- S = A[1:i; 1:i];
- else
- n = min(size(A));
- S = A[n+i+1:n; n+i+1:n];
- }
- else
- S = A[i:j; i:j];
- }
-
- return S;
- };
-